package it.amedeo.utils;

import it.amedeo.mybatis.javaclient.AnagraficheMapper;
import it.amedeo.mybatis.javaclient.LogelabMapper;
import it.amedeo.mybatis.javamodel.Logelab;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.ibatis.session.SqlSession;

public class CreaLogElab {

	public CreaLogElab(String riga) {
		SqlSession sqlSession = MyBatisConnectionFactory.getSqlSession();
		LogelabMapper logelabMapper = sqlSession.getMapper(LogelabMapper.class);
		DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
		Date dataOggi= new Date();
		Logelab logelab = new Logelab();
		logelab.setDatatime(dateFormat.format(dataOggi));
		logelab.setPgmelab("CaricaAmedeo01");
		logelab.setRiga(riga);
		logelabMapper.insert(logelab);
		System.out.println(dateFormat.format(dataOggi) + " " + riga);
	}

}
